package com.wnhz.work.yz.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.wnhz.work.yz.BaseActivity;
import com.wnhz.work.yz.R;

public class SummarizeActivity extends BaseActivity implements View.OnClickListener {
    private TextView title;
    private TextView tv_right;
    private EditText et_content;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_summarize);
        initData();
        initView();
    }

    private String remark = "";

    private void initData() {
        remark = getIntent().getStringExtra("remark");
    }

    private void initView() {
        title = (TextView) findViewById(R.id.view_main_middle_title);
        title.setText("总计");
        findViewById(R.id.btn_main_left).setOnClickListener(this);
        findViewById(R.id.submit).setVisibility(View.VISIBLE);
        findViewById(R.id.submit).setOnClickListener(this);
        tv_right = (TextView) findViewById(R.id.submit);
        tv_right.setVisibility(View.VISIBLE);
        tv_right.setText("保存");
        tv_right.setTextColor(0xff008c99);

        et_content = (EditText) findViewById(R.id.et_content);
        if (!"".equals(remark)) {
            et_content.setText(remark);
        }
    }

    @Override
    public void onClick(View v) {
        Intent intent;
        switch (v.getId()) {
            case R.id.btn_main_left:
                finish();
                break;

            //保存
            case R.id.submit:
                // MyToast("保存");
                if (!et_content.getText().toString().trim().equals("")) {
                    Intent intent1 = new Intent();
                    intent1.putExtra("remark", et_content.getText().toString().trim());
                    setResult(RESULT_OK, intent1);
                }
                finish();
                break;

            default:
                break;
        }
    }
}
